package com.example.framework.excel.exmple;

import com.example.framework.excel.annotation.ExcelExport;
import com.example.framework.excel.annotation.ExcelImport;
import com.example.framework.excel.enums.DecimalType;
import com.example.framework.excel.enums.TimeType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;

/**
 * bean
 * 导入导出测试
 * @author gx
 * @date 2021/6/11 9:47
 */
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ImpExpTemplateSingle {

    @ExcelImport(titleName = "主键ID", column = 1)
    @ExcelExport(titleName = "主键ID", order = 0)
    private Long id;

    @ExcelImport(titleName = "类型", column = 2)
    @ExcelExport(titleName = "类型", order = 1)
    private String type;

    @ExcelImport(titleName = "数字", column = 3,
            cellType = @ExcelImport.CellType(isMoney = true, decimalType = DecimalType.TWO))
    @ExcelExport(titleName = "数字", order = 2,
            cellType = @ExcelExport.CellType(isMoney = true, decimalType = DecimalType.TWO))
    private Double number;

    @ExcelImport(titleName = "金额", column = 4)
    @ExcelExport(titleName = "金额", order = 3)
    private BigDecimal amount;

    @ExcelImport(titleName = "日期", column = 5,
            cellType = @ExcelImport.CellType(timeType = TimeType.DATE_FORMAT))
    @ExcelExport(titleName = "日期", order = 4, cellType = @ExcelExport.CellType(timeType = TimeType.DATE_FORMAT))
    private Date date;

    @ExcelExport(titleName = "错误原因", order = 5, template = false)
    private String error;
}